﻿using System;
using System.Runtime.InteropServices;

namespace Labthink.PCSoft.UniversalHost4.Utility
{
    public class Component
    {
        [DllImport("mpr.dll", EntryPoint = "WNetAddConnection2")]
        public static extern uint WNetAddConnection2(
            [In] NetResource lpNetResource,
            string lpPassword,
            string lpUsername,
            uint dwFlags);

        [DllImport("mpr.dll")]
        public static extern int WNetAddConnection3(IntPtr hWndOwner,
            ref NetResource lpNetResource, string lpPassword,
            string lpUserName, int dwFlags);

        [DllImport("Mpr.dll")]
        public static extern uint WNetCancelConnection2(
            string lpName,
            uint dwFlags,
            bool fForce);

        [StructLayout(LayoutKind.Sequential)]
        public class NetResource
        {
            public int dwScope;
            public int dwType;
            public int dwDisplayType;
            public int dwUsage;
            public string LocalName;
            public string RemoteName;
            public string Comment;
            public string Provider;
        }
    }
}
